/*
 * Copyright (C) 2017
 *
 * Brick Yang <printfxxx@163.com>
 *
 * This program is free software. You can redistribute it and/or
 * modify it as you like.
 */

/**
 * @file	dpio.h
 * @brief	Header file for dpio driver
 */

#ifndef _DPIO_H_
#define _DPIO_H_

#include <linux/types.h>
#include <linux/fsl/mc.h>

enum dpio_channel_mode {
	DPIO_NO_CHANNEL = 0,
	DPIO_LOCAL_CHANNEL = 1,
};

struct dpio_attr {
	int id;
	u64 qbman_portal_ce_offset;
	u64 qbman_portal_ci_offset;
	u16 qbman_portal_id;
	enum dpio_channel_mode channel_mode;
	u8 num_priorities;
	u32 qbman_version;
};

int dpio_open(struct fsl_mc_io *mc_io,
	      u32 cmd_flags,
	      int dpio_id,
	      u16 *token);

int dpio_close(struct fsl_mc_io *mc_io,
	       u32 cmd_flags,
	       u16 token);

int dpio_enable(struct fsl_mc_io *mc_io,
		u32 cmd_flags,
		u16 token);

int dpio_disable(struct fsl_mc_io *mc_io,
		 u32 cmd_flags,
		 u16 token);

int dpio_get_attributes(struct fsl_mc_io *mc_io,
			u32 cmd_flags,
			u16 token,
			struct dpio_attr *attr);

int dpio_reset(struct fsl_mc_io *mc_io,
	       u32 cmd_flags,
	       u16 token);

int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
				  u32 cmd_flags,
				  u16 token,
				  u8 sdest);

int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
				    u32 cmd_flags,
				    u16 token,
				    int dpcon_id,
				    u8 *channel_index);

int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
				       u32 cmd_flags,
				       u16 token,
				       int dpcon_id);

#endif	/* _DPIO_H_ */
